# !/usr/bin/env python
# -*- coding: utf-8 -*-
# @File  : 不含特殊楼层的最大连续楼层数.py
# @Author: dongguangwen
# @Date  : 2025-01-06 22:00
"""
https://leetcode.cn/problems/maximum-consecutive-floors-without-special-floors/description
"""
from typing import List


class Solution:
    def maxConsecutiveFloors(self, bottom: int, top: int, special: List[int]) -> int:
        special.extend([bottom - 1, top + 1])
        special.sort()

        n = len(special)
        ans = 0
        for i in range(n - 1):
            ans = max(ans, special[i + 1] - special[i] - 1)
        return ans


if __name__ == '__main__':
    bottom = 2
    top = 9
    special = [4, 6]
    print(Solution().maxConsecutiveFloors(bottom, top, special))


